#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int pivotIndex(int* nums, int numsSize) {
    int total = 0;
    for (int i = 0; i < numsSize; i++)
    {
        total += nums[i];
    }
    int sum = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (total == 2 * sum + nums[i])
        {
            return i;
        }
        sum += nums[i];
    }
    return -1;
}
int main()
{
    int arr1[7] = { 12,21,33,42,3,57,23 };
    int ret = pivotIndex(arr1, 7);
    printf("%d\n", ret);
    return 0;
}